package com.aoxin.controller.pay.weixinCheckToken;

import com.aoxin.model.weixinIndex.CheckTokenEntity;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/weixinIndex/")
public class IndexWeiXinController {

    /**
     * 微信接入
     * @param checkTokenEntity
     * @return
     */
    @RequestMapping("checkToken")
    @ResponseBody
    public void  checkToken(HttpServletRequest request, HttpServletResponse response){
        // 随机字符串
        String echostr = request.getParameter("echostr");
        try {
            response.getWriter().print(echostr);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
